var mysql = require("mysql");
var config  = require('./config.js'); 
var pool = mysql.createPool(config.mysql);

function query(sql,callback){
    pool.getConnection(function(err,connection){
        if(err){
            console.log(err);
        }else{
            connection.query(sql, function (err,rows) {
                callback(err,rows);
                connection.release();
            }); 
        }
        
    });
}

exports.query = query;